package com.catersystem.zmy.catersystem.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;

import com.catersystem.zmy.catersystem.R;
import com.catersystem.zmy.catersystem.bean.BehindCookBean;
import com.catersystem.zmy.catersystem.bean.DishTypeBean;
import com.catersystem.zmy.catersystem.finals.TimeConstants;
import com.catersystem.zmy.catersystem.utils.DateUtil;
import com.catersystem.zmy.catersystem.utils.TimeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;


/**
 * Created by Administrator on 2017/7/19 0019.
 */

public class BehindCookAdapter extends BaseQuickAdapter<DishTypeBean, BaseViewHolder> {
    public BehindCookAdapter(@Nullable List<DishTypeBean> data) {
        super(R.layout.rv_item_behindcook, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, DishTypeBean item) {
        holder.setGone(R.id.tv_dishes_remark, !TextUtils.isEmpty(item.getTaste()) ? true : false);
        holder.setText(R.id.tv_type, item.getMasterno()).setText(R.id.tv_number, item.getId() + "")
                .setText(R.id.tv_dishes_name, item.getItem_name()).setText(R.id.tv_dishes_num, item.getAmount() +
                item.getSpunit()).setText(R.id.tv_dishes_remark, "(" + item.getTaste() + ")");
        holder.setText(R.id.tv_wait_time, item.getTime());

        switch (item.getStatus()) {
            case 0:
                holder.setText(R.id.tv_cooking_status, R.string.no_cooking);
                holder.setTextColor(R.id.tv_cooking_status, Color.parseColor("#0968bd"));
                holder.setBackgroundRes(R.id.ll_bg, R.drawable.blue_bg_5_shape);
                holder.setBackgroundRes(R.id.rl_bottom_cooking, R.drawable.dark_blue_bg_bottom5_shape);
                break;
            case 1:
                holder.setText(R.id.tv_cooking_status, R.string.cooking);
                holder.setTextColor(R.id.tv_cooking_status, Color.parseColor("#b3720f"));
                holder.setBackgroundRes(R.id.ll_bg, R.drawable.orange_bg_5_shape);
                holder.setBackgroundRes(R.id.rl_bottom_cooking, R.drawable.dark_orange_bg_bottom5_shape);
                break;
        }
    }
}
